﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;

using Javavaj.iHunter;
using Javavaj.iHunter.Core;

namespace Javavaj.iHunter.Viewers
{
    public partial class HtmlViewerControl : UserControl
    {
        /// <summary>
        /// Create a new instance of an HTML Web page viewer
        /// </summary>
        public HtmlViewerControl()
        {
            InitializeComponent();
        }


        #region IViewer Members

        /// <summary>
        /// 显示指定的文档
        /// </summary>
        /// <param name="doc"></param>
        public void ShowDocument(Stream doc)
        {
            webBrowser.Navigate("about:blank");
            using (StreamReader reader = new StreamReader(doc))
            {
                webBrowser.Document.Write(reader.ReadToEnd());
            }
            return;
        }

        #endregion

        #region IViewer 成员

        public string DocumentType
        {
            get 
            {
                return "html";
            
            }
        }

        #endregion

        #region IPlugin 成员

        public void InitSettings(System.Xml.XmlDocument settings)
        {
            return;
        }

        public System.Xml.XmlDocument Config()
        {
            return new System.Xml.XmlDocument();
        }

        #endregion

        #region IViewer 成员


        public new Control CreateControl()
        {
            throw new NotImplementedException();
        }

        public void ShowDocument(Control control, Stream doc)
        {
            throw new NotImplementedException();
        }

        #endregion


    }
}
